package guda.stark.dal.dao.impl;

import guda.grape.autogen.common.BaseDAO;
import guda.stark.dal.dao.SuiteRenderRelDAO;
import guda.stark.dal.dataobject.SuiteRenderRelDO;
import guda.grape.autogen.common.page.BaseQuery;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class SuiteRenderRelDAOImpl extends BaseDAO implements SuiteRenderRelDAO {

    @Override
	public Long insert(SuiteRenderRelDO suiteRenderRel) {
	      try {
                return (Long) getSqlMapperW().insert("suite_render_rel.insert",suiteRenderRel);
          } catch (Exception e) {
                throw new RuntimeException(e);
          }

	}

    @Override
	public SuiteRenderRelDO getSuiteRenderRelById(Long relId) {
	    return (SuiteRenderRelDO)getSqlMapClientTemplate().queryForObject("suite_render_rel.getSuiteRenderRelById", relId);
	}

    @Override
	public boolean delSuiteRenderRelById(Long relId) {
	    int num = 0;
        try {
            num = getSqlMapperW().delete("suite_render_rel.delSuiteRenderRelById",relId);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        if(num>0){
            return true;
        }else{
            return false;
        }
	}

    @Override
	public List<SuiteRenderRelDO> getSuiteRenderRelByIds(List idsList) {
        Map m = new HashMap();
        m.put("idsList",idsList);
		return getSqlMapClientTemplate().queryForList("suite_render_rel.selectByIds", m);
	}

    @Override
	public void cleanAutoIncrement(Long relId) {
	    try {
            getSqlMapperW().update("suite_render_rel.cleanAutoIncrement",relId);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
	}

    @Override
    public List<SuiteRenderRelDO> selectForPage(BaseQuery baseQuery) {
        return getSqlMapClientTemplate().queryForList("suite_render_rel.selectForPage", baseQuery);
    }

    @Override
    public int countForPage(BaseQuery baseQuery) {
        return (Integer)getSqlMapClientTemplate().queryForObject("suite_render_rel.countForPage",baseQuery);
    }

    @Override
    public void updateByIdSelective(SuiteRenderRelDO suiteRenderRel) {
        try {
            getSqlMapperW().update("suite_render_rel.updateByIdSelective",suiteRenderRel);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

}

